import request from '@/utils/request'

// 查询电表列表
export function listElectricity(query) {
    return request({
        url: '/manage-api/zufang/electric-meter/page',
        method: 'get',
        params: query
    })
}

// 查询电表详细
export function getElectricity(id) {
    return request({
        url: '/manage-api/zufang/electric-meter/get?id=' + id,
        method: 'get'
    })
}

// 新增电表
export function addElectricity(data) {
    return request({
        url: '/manage-api/zufang/electric-meter/create',
        method: 'post',
        data: data
    })
}

// 修改电表
export function updateElectricity(data) {
    return request({
        url: '/manage-api/zufang/electric-meter/update',
        method: 'put',
        data: data
    })
}

// 删除电表
export function delElectricity(id) {
    return request({
        url: '/manage-api/zufang/electric-meter/delete?id=' + id,
        method: 'delete'
    })
}

// 抄表
export function readingElectricMeter(data) {
    return request({
        url: '/manage-api/zufang/electric-meter/reading',
        method: 'post',
        data: data
    })
}
// 强制拉闸/解除拉闸
export function forceoffElectricMeter(data) {
    return request({
        url: '/manage-api/zufang/electric-meter/forceOff',
        method: 'post',
        data: data
    })
}

// 查询电表定时任务
export function getSchedule(sn) {
    return request({
        url: '/zufang/device-schedule/get?sn=' + sn,
        method: 'get'
    })
}

// 给电表添加定时任务
export function addSchedule(data) {
    return request({
        url: '/zufang/electric-meter/schedule',
        method: 'post',
        data: data
    })
}

// 充值电表
export function payElectricMeter(data) {
    return request({
        url: '/zufang/electric-meter/pay',
        method: 'post',
        data: data
    })
}

// 电表明细
export function getElectricMeterDetail(params) {
    return request({
        url: '/manage-api/zufang/electric-meter/consumer/month-total-detail',
        method: 'get',
        params: params
    })
}
